<?php
declare(strict_types=1);
//缓存,redis
class Cache
{
    private static object $_instance;
    private object $redis;
    public function __construct()
    {
        $this->redis = new Redis();
        try {
            $this->redis->pconnect('127.0.0.1', '6379');
        } catch (Exception $e) {
            echo $e->getMessage();
        }
    }
    public static function getInstance(){
        if (empty(self::$_instance)) self::$_instance = new self();
        return self::$_instance->redis;
    }
}